C
C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C Beginning of LMT6.INC
C Version 6.0: 05-25-2001
C Version 6.1: 05-01-2002
C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c
C INSERT THE FOLLOWING STATEMENTS INTO MODFLOW-2000 MAIN PROGRAM
C IMMEDIATELY AFTER CALLS TO ALL BUDGET SUBROUTINES.
C ----------------------------------------------------------------------
C
C--IF 1st PARAMETER ITERATION, 1st TIME STEP AND 1st STRESS PERIOD,
C--CHECK AND SET UP Link-MT3DMS OPTIONS
      IF(KKSTP*KKPER.EQ.1) THEN
        CALL LMT6BAS6(INUNIT,IOUT,NCOL,NROW,NLAY,NPER,ISS,NODES,
     &   IUNIT,CUNIT,NIUNIT,IG(LCIBOU),IMT3D,ILMTHEAD)
      ENDIF
C
C--IF Link-MT3DMS PACKAGE IF NOT USED, SKIP
      IF(IMT3D.GT.0) THEN
C
C--WRITE A NOTIFICATION LINE TO MODFLOW OUTPUT FILE
        WRITE(IOUT,9876) IMT3D,KKSTP,KKPER
 9876   FORMAT(/1X,'SAVING SATURATED THICKNESS AND FLOW TERMS ON UNIT',
     &   I5,' FOR MT3DMS',/1X,'BY THE LINK-MT3DMS PACKAGE V6.0',
     &   ' AT TIME STEP',I5,', STRESS PERIOD',I5/)
C
C--COLLECT AND SAVE ALL RELEVANT FLOW MODEL INFORMATION
        IF(IUNIT(1).GT.0) CALL LMT6BCF6(GZ(LCHNEW),IG(LCIBOU),GX(LCCR),
     &   GX(LCCC),GX(LCCV),ISS,ISSFLG(KKPER),DELT,RX(LCSC1),RX(LCSC2),
     &   GX(LCHOLD),GX(LCBOTM),NBOTM,NCOL,NROW,NLAY,KKSTP,KKPER,
     &   GX(LCBUFF),IMT3D)
        IF(IUNIT(23).GT.0) CALL LMT6LPF1(GZ(LCHNEW),IG(LCIBOU),
     &   GX(LCCR),GX(LCCC),GX(LCCV),ISS,ISSFLG(KKPER),DELT,X(LCSC1),
     &   X(LCSC2),GX(LCHOLD),GX(LCBOTM),NBOTM,NCOL,NROW,NLAY,
     &   KKSTP,KKPER,GX(LCBUFF),IMT3D)
        IF(IUNIT(37).GT.0) CALL LMT6HUF1(GZ(LCHNEW),IG(LCIBOU),
     &   GX(LCCR),GX(LCCC),GX(LCCV),ISS,ISSFLG(KKPER),DELT,GX(LCHOLD),
     &   X(LCSC1),GX(LCBOTM),NBOTM,NCOL,NROW,NLAY,KKSTP,KKPER,
     &   X(LCHUFTHK),NHUF,IG(LCIZON),NZONAR,GX(LCRMLT),NMLTAR,
     &   GX(LCDELR),GX(LCDELC),GX(LCBUFF),IMT3D)
        IF(IUNIT(2).GT.0) CALL LMT6WEL6(NWELLS,MXWELL,NWELVL,
     &   RX(LCWELL),IG(LCIBOU),NCOL,NROW,NLAY,KKSTP,KKPER,IMT3D)
        IF(IUNIT(3).GT.0) CALL LMT6DRN6(NDRAIN,MXDRN,NDRNVL,
     &   RX(LCDRAI),GZ(LCHNEW),NCOL,NROW,NLAY,IG(LCIBOU),KKSTP,
     &   KKPER,IMT3D)
        IF(IUNIT(8).GT.0) CALL LMT6RCH6(NRCHOP,IR(LCIRCH),RX(LCRECH),
     &   IG(LCIBOU),NROW,NCOL,NLAY,KKSTP,KKPER,GX(LCBUFF),IMT3D)
        IF(IUNIT(5).GT.0) CALL LMT6EVT6(NEVTOP,IR(LCIEVT),RX(LCEVTR),
     &   RX(LCEXDP),RX(LCSURF),IG(LCIBOU),GZ(LCHNEW),NCOL,NROW,NLAY,
     &   KKSTP,KKPER,GX(LCBUFF),IMT3D)
        IF(IUNIT(4).GT.0) CALL LMT6RIV6(NRIVER,MXRIVR,NRIVVL,
     &   RX(LCRIVR),IG(LCIBOU),
     &   GZ(LCHNEW),NCOL,NROW,NLAY,KKSTP,KKPER,IMT3D)
        IF(IUNIT(18).GT.0.AND.ILMTHEAD.EQ.0)
     &   CALL LMT6STR6(NSTREM,RX(LCSTRM_),IR(ICSTRM_),IG(LCIBOU),
     &   MXSTRM,NCOL,NROW,NLAY,KKSTP,KKPER,IMT3D,ILMTHEAD)
        IF(IUNIT(7).GT.0) CALL LMT6GHB6(NBOUND,MXBND,NGHBVL,
     &   RX(LCBNDS),GZ(LCHNEW),NCOL,NROW,NLAY,IG(LCIBOU),KKSTP,
     &   KKPER,IMT3D)
        IF(IUNIT(18).GT.0.AND.ILMTHEAD.EQ.1)
     &   CALL LMT6STR6(NSTREM,RX(LCSTRM_),IR(ICSTRM_),IG(LCIBOU),
     &   MXSTRM,NCOL,NROW,NLAY,KKSTP,KKPER,IMT3D,ILMTHEAD)
        IF(IUNIT(17).GT.0) CALL LMT6RES1(IR(LCIRES),IR(LCIRSL),
     &   RX(LCBRES),RX(LCCRES),RX(LCBBRE),RX(LCHRES),IG(LCIBOU),
     &   GZ(LCHNEW),GX(LCBUFF),KKSTP,KKPER,NRES,NRESOP,
     &   NCOL,NROW,NLAY,IMT3D)
        IF(IUNIT(16).GT.0) CALL LMT6FHB1(IR(LCFLLC),RX(LCBDFV),NFLW,
     &   IG(LCIBOU),NCOL,NROW,NLAY,KKSTP,KKPER,IFHBD4,NFLWDIM,IMT3D)
C
      ENDIF
C
C~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C END OF LMT6.INC
C~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C
